package com.opennetexam.manager.utils;

import com.opennetexam.manager.common.ApplicationContextProvider;
import com.opennetexam.manager.config.RedisDao;

/**
 * @Description TODO
 * @Author 奶茶
 * Created by on 2018/11/8 10:39.
 */
public class RedisUtil {

    private static RedisDao redisDao;

    static {
        redisDao = ApplicationContextProvider.getBean(RedisDao.class);
    }


    public static void setValue(String key,String value,Integer timeOut){
        if(timeOut != null){
            redisDao.setValue(key, value, timeOut);
        }else{
            redisDao.setValue(key, value);
        }
    }


    public static String getValue(String key){
        return redisDao.getValue(key);
    }

    public static void delete(String key){
        redisDao.delete(key);
    }
}
